package com.hileto.inf.utils;

/**
 * Copyright: Copyright (c) 2012
 *     深圳市海乐淘电子商务有限公司
 * @Author : 曾林宝
 * @CreateTime : 2013-1-21 上午10:23:00
 *
 * @Description: 生成hash key的工具类.
 */
public final class KeyFactory {
	protected static final String key1Demo = "!$%^@abcd#$#@";
	protected static final String key2Demo = "badf12313asdf2aa";

	public static String createKey(String memberID) {
		StringBuilder str = new StringBuilder(20);
		int key1 = (key1Demo + memberID).hashCode();
		int key2 = (memberID + key2Demo).hashCode();
		str.append(Integer.toHexString(key1) + Integer.toHexString(key2));

		return str.toString();
	}
	
	public static String getModelCacheKey(Class<?> clazz, Object id) {
		return clazz.getName() + "@" + id;
	}
}